<?php get_header(); ?>

<div class="indextop">

<div class="randomgames">
<?php if (have_posts()) : ?>

<div class="randomtop2">
 	  <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
 	  <?php /* If this is a category archive */ if (is_category()) { ?>
		<h2 class="pagetitle"><?php single_cat_title(); ?> Games</h2>
 	  <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
		<h2 class="pagetitle"><?php single_tag_title(); ?> Games</h2>
 	  <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
		<h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2>
 	  <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
		<h2 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h2>
 	  <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
		<h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>
	  <?php /* If this is an author archive */ } elseif (is_author()) { ?>
		<h2 class="pagetitle">Author Archive</h2>
 	  <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
		<h2 class="pagetitle">Blog Archives</h2>
 	  <?php } ?>
</div>

<div class="randomgame">

<?php while (have_posts()) : the_post(); ?>
<div class="gamethumb">

<div class="thumbs">
<a href="<?php the_permalink() ?>" title="Play <?php the_title_attribute(); ?>"><img src="<?php $values = get_post_custom_values("thumb"); echo $values[0]; ?>" alt="" height="80" width="96" /></a>
</div>
<div class="thumbtitle">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Play <?php the_title_attribute(); ?>"><?php
$tit = the_title('','',FALSE);
echo substr($tit, 0, 15);
if (strlen($tit) > 15) echo " ...";
?></a>
</div>
</div>
<?php endwhile; ?>

</div>

<div class="randombottom"></div>
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi('', '', '', '', 3, false);} ?>
<?php endif; ?>
</div>

<?php include (TEMPLATEPATH . '/ads/ad-336-280.php'); ?>

</div>


<?php get_footer(); ?>
